<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>时间线记录内存变化</title>
</head>
<body>
  <button id='btn'>add</button>

  <script>
    const arr = []
    
    function test () {
      // 创建大量dom节点
      for (let i = 0; i < 100000; i++) {
        document.body.append(document.createElement('p'))
      }

      // 创建一百万长度的字符串
      arr.push(new Array(10000000).join('x'))
    }

    document.getElementById('btn').addEventListener('click', test)
  </script>
</body>
</html>